package com.itheima.bean;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
//@Component
@EnableConfigurationProperties(CartoonProperties.class)
//@ConfigurationProperties(prefix = "cartoon")
public class CartoonCatAndMouse {
    private Cat cat;
    private Mouse mouse;
    public CartoonCatAndMouse(CartoonProperties cartoonProperties){
        cat=new Cat();
        cat.setName(cartoonProperties.getCat().getName());
        cat.setAge(3);
        mouse=new Mouse();
        mouse.setName("jerry");
        mouse.setAge(4);
    }
    public void play(){
        System.out.println(cat.getAge()+"岁的"+cat.getName()+"和"+mouse.getAge()+"岁的"+mouse.getName()+"打起来了");
    }
}
